<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title><?php echo ($meta_title); ?>|管理平台</title>
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/base.css" media="all">
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/common.css" media="all">
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/module.css">
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/style.css" media="all">
	<link rel="stylesheet" type="text/css" href="/Public/Admin/css/<?php echo (C("COLOR_STYLE")); ?>.css" media="all">
     <!--[if lt IE 9]>
    <script type="text/javascript" src="/Public/static/jquery-1.10.2.min.js"></script>
    <![endif]--><!--[if gte IE 9]><!-->
    <script type="text/javascript" src="/Public/static/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="/Public/Admin/js/jquery.mousewheel.js"></script>
     <!--<link rel="stylesheet" href="/Public/Admin/css/ace.min.css" id="main-ace-style" />-->
     <!--<link rel="stylesheet" href="/Public/Admin/css/bootstrap.min.css" />-->
    <!--<![endif]-->
    


</head>
<body>
    <!-- 头部 -->
    <div class="header">
        <!-- 主导航 -->
        <ul class="main-nav">
            <li style="width: 200px; color:#fff; font-size: 18px; font-weight: bold; text-align: center; ">
            懒人智库后台
            </li>
            <?php if(is_array($__MENU__["main"])): $i = 0; $__LIST__ = $__MENU__["main"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;?><li class="<?php echo ((isset($menu["class"]) && ($menu["class"] !== ""))?($menu["class"]):''); ?>"><a href="<?php echo (U($menu["url"])); ?>"><?php echo ($menu["title"]); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
        </ul>
        <!-- /主导航 -->

        <!-- 用户栏 -->
        <div class="user-bar">
            <a href="javascript:;" class="user-entrance"><i class="icon-user"></i></a>
            <ul class="nav-list user-menu hidden">
                <li class="manager">你好，<em title="<?php echo session('user_auth.username');?>"><?php echo session('user_auth.username');?></em></li>
                <li><a href="<?php echo U('User/updatePassword');?>">修改密码</a></li>
                <li><a href="<?php echo U('User/updateNickname');?>">修改昵称</a></li>
                <li><a href="<?php echo U('Public/logout');?>">退出</a></li>
            </ul>
        </div>
    </div>
    <!-- /头部 -->

    <!-- 边栏 -->
    <div class="sidebar">
        <!-- 子导航 -->
        
            <div id="subnav" class="subnav">
                <?php if(!empty($_extra_menu)): ?>
                    <?php echo extra_menu($_extra_menu,$__MENU__); endif; ?>
                <?php if(is_array($__MENU__["child"])): $i = 0; $__LIST__ = $__MENU__["child"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$sub_menu): $mod = ($i % 2 );++$i;?><!-- 子导航 -->
                    <?php if(!empty($sub_menu)): if(!empty($key)): ?><h3><i class="icon icon-unfold"></i><?php echo ($key); ?></h3><?php endif; ?>
                        <ul class="side-sub-menu">
                            <?php if(is_array($sub_menu)): $i = 0; $__LIST__ = $sub_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;?><li>
                                    <a class="item" href="<?php echo (U($menu["url"])); ?>"><?php echo ($menu["title"]); ?></a>
                                </li><?php endforeach; endif; else: echo "" ;endif; ?>
                        </ul><?php endif; ?>
                    <!-- /子导航 --><?php endforeach; endif; else: echo "" ;endif; ?>
            </div>
        
        <!-- /子导航 -->
    </div>
    <!-- /边栏 -->

    <!-- 内容区 -->
    <div id="main-content">
        <div id="top-alert" class="fixed alert alert-error" style="display: none;">
            <button class="close fixed" style="margin-top: 4px;">&times;</button>
            <div class="alert-content">这是内容</div>
        </div>
        <div id="main" class="main">
            
            <!-- nav -->
            <?php if(!empty($_show_nav)): ?><div class="breadcrumb">
                <span>您的位置:</span>
                <?php $i = '1'; ?>
                <?php if(is_array($_nav)): foreach($_nav as $k=>$v): if($i == count($_nav)): ?><span><?php echo ($v); ?></span>
                    <?php else: ?>
                    <span><a href="<?php echo ($k); ?>"><?php echo ($v); ?></a>&gt;</span><?php endif; ?>
                    <?php $i = $i+1; endforeach; endif; ?>
            </div><?php endif; ?>
            <!-- nav -->
            

            

    <!-- 标题栏 -->
    <div class="main-title">
        <h2>用户列表</h2>
    </div>
    <div class="cf">
        <div class="fl">
            <form action="" method="POST">
                <input type="text" name="keywords" class="text input-4x" value="<?php echo ($keywords); ?>" placeholder="手机号/真实姓名/所在公司" />&nbsp; &nbsp;
                <button class="btn" type="submit">筛选</button>
            </form>
            <!--            <a class="btn" href="<?php echo U('add');?>">新 增</a>-->
            <!--            <button class="btn ajax-post confirm" url="<?php echo U('changeStatus?method=deleteUser');?>" target-form="ids">删 除</button>-->
        </div>
        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <!--<a class="sch-btn" href="javascript:;" id="search" url="<?php echo U('index');?>"><i class="btn-search"></i></a>-->
        </div>
    </div>
    <div class="tab-wrap">
        <ul class="tab-nav nav">
            <li <?php if($_GET['tab'] == 1):?>class="current"<?php endif;?>><a href="<?php echo U('index',array('tab'=>1));?>">已通过</a></li>
            <li <?php if($_GET['tab'] == 0):?>class="current"<?php endif;?>><a href="<?php echo U('index',array('tab'=>0));?>">待审核</a></li>
            <li <?php if($_GET['tab'] == 2):?>class="current"<?php endif;?>><a href="<?php echo U('index',array('tab'=>2));?>">已拒绝</a></li>
        </ul>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <table class="">
            <thead>
                <tr>
                    <th class="">用户ID</th>
                    <th class="">手机号</th>
                    <?php if($tab == 1):?>
                    <th class="">昵称</th>
                    <th class="">头像</th>
                    <?php endif;?>
                    <th class="">真实姓名</th>
                    <th class="">职位</th>
                    <th class="">所在公司</th>
                    <th class="">经营渠道</th>
                    <th class="">公司传真</th>
                    <th class="">公司地址</th>
                    <?php if($tab == 1):?>
                    <th class="">账号状态</th>
                    <th class="">操作</th>
                    <?php elseif($tab == 2):?>
                    <th class="">拒绝原因</th>
                    <?php else:?>
                    <th class="">操作</th>
                    <?php endif;?>
                </tr>
            </thead>
            <tbody>
            <?php if(!empty($_list)): if(is_array($_list)): $i = 0; $__LIST__ = $_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
                        <td><?php echo ($vo["user_id"]); ?> </td>
                        <td><?php echo ($vo["phone"]); ?></td>
                        <?php if($tab == 1):?>
                        <td><?php echo ($vo["nick_name"]); ?></td>
                        <td><img src="<?php echo ($vo["face"]); ?>" style="width:80px;"></td>
                        <?php endif;?>
                        <td><?php echo ($vo["real_name"]); ?></td>
                        <td><?php echo ($vo["position"]); ?></td>
                        <td><?php echo ($vo["company"]); ?></td>
                        <td><?php echo ($vo["channel"]); ?></td>
                        <td><?php echo ($vo["fax"]); ?></td>
                        <td><?php echo ($vo["company_address"]); ?></td>
                        <?php if($tab == 1):?>

                        <td><?php if(($vo['account_status']) == "1"): ?>禁用<?php else: ?>正常<?php endif; ?></td>
                    <td>
                        <?php if(($vo['account_status']) == "1"): ?><a href="<?php echo U('editAccountStatus',array('user_id'=>$vo['user_id'],'account_status'=>0));?>" class="confirm ajax-get">启用</a>
                    <?php else: ?>
                    <a href="<?php echo U('editAccountStatus',array('user_id'=>$vo['user_id'],'account_status'=>1));?>" class="confirm ajax-get">禁用</a><?php endif; ?>
                    </td>   
                    <?php elseif($tab == 2):?>
                    <td><?php echo ($vo["refuse_desc"]); ?></td>
                    <?php else:?>
                    <td>
                        <a href="javascript:;" data-id="<?php echo ($vo['user_id']); ?>"  class="tongyi">同意</a>
                        &nbsp; 
                        <a href="javascript:;" data-id="<?php echo ($vo['user_id']); ?>" class="jujue">拒绝</a>
                    </td>   
                    <?php endif;?>
                    </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                <?php else: ?>
                <td colspan="20" class="text-center"> aOh! 暂时还没有内容! </td><?php endif; ?>
            </tbody>
        </table>
    </div>
    <div class="page">
        <?php echo ($_page); ?>
    </div>
    <div class="show-box-back"  style="display: none;">
    </div>
    <!-- 审核通过框 -->
    <div class="show-box" id="js-tongguo" style="display: none;">
        <input type="hidden" name="company_id" id="js-tongguo-id">
        <input type="hidden" name="company_status" value="1">
        <div class="show-box-msg" >
            提示
        </div>
        <div class="show-box-msg-content">
            确认通过该用户吗
        </div>
        <div class="show-box-bottom">
            <button class="js-show-btn-cancel btn btn-return " >返 回</button>
            <button class="js-show-btn-ok btn submit-btn" id="submit-tongguo" >确 定</button>

        </div>
    </div>

    <!-- 审核拒绝框 -->
    <div class="show-box" id="js-jujue" style="display: none;">
        <input type="hidden" name="company_id" id="js-jujue-id">
        <input type="hidden" name="company_status" value="2">
        <div class="show-box-msg" >
            提示
        </div>
        <div class="show-box-msg-title">
            拒绝原因:
        </div>
        <div class="show-box-msg-area">
            <textarea class="show-box-msg-area" name="refund_desc" id="refund_desc" rows="3" cols="35"></textarea>
        </div>
        <div class="show-box-bottom">
            <button class="js-show-btn-cancel btn btn-return" >返 回</button>
            <button class="btn submit-btn" id="submit-jujue" >确 定</button>

        </div>
    </div>

    <div class="show-box" id="js-tupian" style="display: none;">
        <img id="js-img" height="300" width="200">
    </div>

        </div>
        <div class="cont-ft">
            <div class="copyright">
                <div class="fl">感谢使用 管理平台</div>
            </div>
        </div>
    </div>
    <!-- /内容区 -->
    <script type="text/javascript">
    (function(){
        var ThinkPHP = window.Think = {
            "ROOT"   : "", //当前网站地址
            "APP"    : "/admin.php?s=", //当前项目地址
            "PUBLIC" : "/Public", //项目公共目录地址
            "DEEP"   : "<?php echo C('URL_PATHINFO_DEPR');?>", //PATHINFO分割符
            "MODEL"  : ["<?php echo C('URL_MODEL');?>", "<?php echo C('URL_CASE_INSENSITIVE');?>", "<?php echo C('URL_HTML_SUFFIX');?>"],
            "VAR"    : ["<?php echo C('VAR_MODULE');?>", "<?php echo C('VAR_CONTROLLER');?>", "<?php echo C('VAR_ACTION');?>"]
        }
    })();
    </script>
    <script type="text/javascript" src="/Public/static/think.js"></script>
    <script type="text/javascript" src="/Public/Admin/js/common.js"></script>
    <script type="text/javascript">
        +function(){
            var $window = $(window), $subnav = $("#subnav"), url;
            $window.resize(function(){
                $("#main").css("min-height", $window.height() - 130);
            }).resize();

            /* 左边菜单高亮 */
            url = window.location.pathname + window.location.search;
            url = url.replace(/(\/(p)\/\d+)|(&p=\d+)|(\/(id)\/\d+)|(&id=\d+)|(\/(group)\/\d+)|(&group=\d+)/, "");
            $subnav.find("a[href='" + url + "']").parent().addClass("current");

            /* 左边菜单显示收起 */
            $("#subnav").on("click", "h3", function(){
                var $this = $(this);
                $this.find(".icon").toggleClass("icon-fold");
                $this.next().slideToggle("fast").siblings(".side-sub-menu:visible").
                      prev("h3").find("i").addClass("icon-fold").end().end().hide();
            });

            $("#subnav h3 a").click(function(e){e.stopPropagation()});

            /* 头部管理员菜单 */
            $(".user-bar").mouseenter(function(){
                var userMenu = $(this).children(".user-menu ");
                userMenu.removeClass("hidden");
                clearTimeout(userMenu.data("timeout"));
            }).mouseleave(function(){
                var userMenu = $(this).children(".user-menu");
                userMenu.data("timeout") && clearTimeout(userMenu.data("timeout"));
                userMenu.data("timeout", setTimeout(function(){userMenu.addClass("hidden")}, 100));
            });

	        /* 表单获取焦点变色 */
	        $("form").on("focus", "input", function(){
		        $(this).addClass('focus');
	        }).on("blur","input",function(){
				        $(this).removeClass('focus');
			        });
		    $("form").on("focus", "textarea", function(){
			    $(this).closest('label').addClass('focus');
		    }).on("blur","textarea",function(){
			    $(this).closest('label').removeClass('focus');
		    });

            // 导航栏超出窗口高度后的模拟滚动条
            var sHeight = $(".sidebar").height();
            var subHeight  = $(".subnav").height();
            var diff = subHeight - sHeight; //250
            var sub = $(".subnav");
            if(diff > 0){
                $(window).mousewheel(function(event, delta){
                    if(delta>0){
                        if(parseInt(sub.css('marginTop'))>-10){
                            sub.css('marginTop','0px');
                        }else{
                            sub.css('marginTop','+='+10);
                        }
                    }else{
                        if(parseInt(sub.css('marginTop'))<'-'+(diff-10)){
                            sub.css('marginTop','-'+(diff-10));
                        }else{
                            sub.css('marginTop','-='+10);
                        }
                    }
                });
            }
        }();
    </script>
    
    <script src="/Public/static/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });
        //搜索功能
        $(".tongyi").click(function () {
            var id = $(this).attr("data-id");
            $('#js-tongguo').show();
            $('.show-box-back').show();
            $('#js-tongguo-id').val(id);
        });
        //搜索功能
        $(".jujue").click(function () {
            var id = $(this).attr("data-id");
            $('#js-jujue').show();
            $('.show-box-back').show();
            $('#js-jujue-id').val(id);
        });
      

        $("#submit-tongguo").click(function () {

            var id = $("#js-tongguo-id").val();
            $.post("<?php echo U('edit');?>", {user_id: id, status: 1}, function (res) {
                if (res.status) {
                    updateAlert('审核成功', 'alert-success');
                    setTimeout(function () {
                        location.reload();
                    }, 1500);
                }
            });
        });
        $("#submit-jujue").click(function () {
            var id = $("#js-jujue-id").val();
            var refund_desc = $("#refund_desc").val();
            $.post("<?php echo U('edit');?>", {user_id: id, status: 2, refund_desc: refund_desc}, function (res) {
                if (res.status) {
                    updateAlert('审核成功', 'alert-success');
                    setTimeout(function () {
                        location.reload();
                    }, 1500);
                }
            });

        });

        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        //导航高亮

        highlight_subnav("<?php echo U('Users/index',array('tab'=>0));?>");
    </script>

</body>
</html>